<template>
  <div>
    <CategorySelector :isForbiddenForm="scene === 1"></CategorySelector>
    <el-card style="margin-top: 10px">
      <SpuList
        v-if="scene === 1"
        @changeScene="saveScene"
        @getSpuInfo="saveSpuInfo"
      ></SpuList>
      <SpuForm
        v-if="scene === 2"
        @changeScene="saveScene"
        :currentSpuInfo="currentSpuInfo"
      ></SpuForm>
      <SkuForm
        v-if="scene === 3"
        @changeScene="saveScene"
        :currentSpuInfo="currentSpuInfo"
      ></SkuForm>
    </el-card>
  </div>
</template>

<script lang="ts">
import CategorySelector from '@/components/CategorySelector/index.vue'
import SpuList from './components/SpuList.vue'
import SpuForm from './components/SpuForm.vue'
import SkuForm from './components/SkuForm.vue'
export default {
  name: 'Spu',
  components: { CategorySelector, SpuList, SpuForm, SkuForm },
}
</script>

<script lang="ts" setup>
import { ref } from 'vue'

import { Plus, Edit, Delete, InfoFilled } from '@element-plus/icons-vue'

const scene = ref(1)

const currentSpuInfo = ref([])

const currentPage = ref<number>(1)
const pageSize = ref<number>(5)

const saveScene = (val: number) => {
  scene.value = val
}

const saveSpuInfo = (spuInfo) => {
  currentSpuInfo.value = spuInfo
}
</script>
<style></style>
